﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;


using DZ.Data_Modals;  //CP@07.Dec14
using DZ.Data__Class;
namespace DZ.Forms
{
    /// <summary>
    /// Interaction logic for PrintBarCodeLabel.xaml
    /// </summary>
    public partial class PrintBarCodeLabel : Window
    {
        
        DB_DZA_Entities dbContext = new DB_DZA_Entities();
        //System.Windows.Forms.AutoCompleteStringCollection AntList=new aut

        TblAntibody objAntibody = new TblAntibody();
        public PrintBarCodeLabel()
        {
            InitializeComponent();
           // AntList = new AutoCompleteStringCollection();
            //FillGrid();
            //var source=new   
           
           // ANamelist = new List();
            //var query = from data in dbContext.TblAntibodies
            //            //orderby data.AnBID_PK
            //            //where data.AnBID_PK == objAntibody.AnBID_PK && data.AntiBodyName == objAntibody.AntiBodyName
            //            select data;//.AntiBodyName;
            //     foreach (TblAntibody details in query)
            //    {

            //            Namelist.Add(details.AntiBodyName.ToString());
            //    }
            //Namelist =new List<string>
            //{
            //    foreach()
            //    {

            //    }
            //};
            // Namelist = new List<string>
            //{
           
                     
            //};
         
            
            //foreach (TblAntibody details in query)
            //{
            //    Namelist = new List<string>
            //    {
            //        Namelist.Add(details.AntiBodyName.ToString )
            //    };
            //}
            //txtAntiBodyName.TextChanged += new TextChangedEventHandler(txtAntiBodyName_TextChanged );
            
        }
        private void FillGrid()
        {
            try
            {
                
                List<TblAntibody> TableData = dbContext.TblAntibodies.Where(s => s.AntiBodyName  == txtAntiBodyName .Text).ToList();
                gvAntiBody.ItemsSource = TableData;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }    
        }

        private void bntSearch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //DB_DZA_Entities dbContext = new DB_DZA_Entities();
                //List<TblAntibody> TableData = dbContext.TblAntibodies.Where(s => s.AntiBodyName == txtAntiBodyName.Text).ToList();
                //gvAntiBody.ItemsSource = TableData;
                FillGrid();
            }
               
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }   
        }

        private void bntClose_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }   
        }

        private void txtAntiBodyName_TextChanged(object sender, TextChangedEventArgs e)
        {
            
        }

       

    }
}
